package com.tang.mediator.factory.impl;

import com.tang.config.Configuration;
import com.tang.mediator.factory.SqlSessionFactory;
import com.tang.mediator.sqlsession.SqlSession;
import com.tang.mediator.sqlsession.impl.DefaultSqlSession;

public class DefaultSqlSessionFactory implements SqlSessionFactory {

    private final Configuration configuration;

    public DefaultSqlSessionFactory(Configuration configuration) {
        this.configuration = configuration;
    }

    @Override
    public SqlSession openSession() {
        return new DefaultSqlSession(configuration.getConnection(), configuration.getMapperElement());
    }

}
